Skip to content

240 add skeleton fab script#246

Open
hiker wants to merge 13 commits intoMetOffice:mainfrom
hiker:240_add_skeleton_fab_script
Open

240 add skeleton fab script#246
hiker wants to merge 13 commits intoMetOffice:mainfrom
hiker:240_add_skeleton_fab_script

Conversation

@hiker
Copy link

@hiker hiker commented Jan 27, 2026

PR Summary

Sci/Tech Reviewer: @MatthewHambley
Code Reviewer: @t00sa

Adds a first Fab build script for Skeleton. To keep this change minimal, it's command line only (i.e. no cylc integration, which can come later).

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings
  • All automated checks in the CI pipeline have completed successfully

Testing

  • I have tested this change locally, using the LFRic Core rose-stem suite
  • If required (e.g. API changes) I have also run the LFRic Apps test suite using this branch
  • If any tests fail (rose-stem or CI) the reason is understood and acceptable (e.g. kgo changes)
  • I have added tests to cover new functionality as appropriate (e.g. system tests, unit tests, etc.)
  • Any new tests have been assigned an appropriate amount of compute resource and have been allocated to an appropriate testing group (i.e. the developer tests are for jobs which use a small amount of compute resource and complete in a matter of minutes)

trac.log

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

Performance Impact

  • Performance of the code has been considered and, if applicable, suitable performance measurements have been conducted

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

Documentation

  • Where appropriate I have updated documentation related to this change and confirmed that it builds correctly

PSyclone Approval

  • If you have edited any PSyclone-related code (e.g. PSyKAl-lite, Kernel interface, optimisation scripts, LFRic data structure code) then please contact the TCD Team

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

(Please alert the code reviewer via a tag when you have approved the SR)

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • CLA compliance has been confirmed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Documentation is complete and accurate
  • Security considerations have been addressed
  • Performance impact is acceptable

@hiker hiker marked this pull request as draft January 27, 2026 06:04
@github-actions github-actions bot added the cla-required The CLA has not yet been signed by the author of this PR - added by GA label Jan 27, 2026
@github-actions github-actions bot added cla-signed The CLA has been signed as part of this PR - added by GA and removed cla-required The CLA has not yet been signed by the author of this PR - added by GA labels Jan 27, 2026
@hiker
Copy link
Author

hiker commented Jan 27, 2026

This PR only adds a command-line build system using Fab for the Skeleton apps. It is not at all integrated into cylc or any other test suite. Tests have been added to the infrastructure/build/fab scripts which cover the newly added infrastructure files there.

Some unit tests are based on some AI input to setup the frame work, but have been manually tweaked to ensure code coverage.

Documentation is in form of a README in the above directory, please let me know if you want me to add more elsewhere.

@hiker hiker marked this pull request as ready for review January 27, 2026 07:37
@yaswant yaswant requested review from t00sa and removed request for mike-hobson and stevemullerworth February 5, 2026 09:26
Copy link
Collaborator

@MatthewHambley MatthewHambley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I note that a lot of requests made in the original review on SRS have not been addressed so for convenience I have repeated them here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic build components should be in lfric_build at the top level, not infrastructure/build.

Comment on lines +46 to +49
def process(self, input_template: Path,
output_file: Path,
key_values: Dict[str, str]) -> None:
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives the correct input arguments. Presumably it would be a bad thing to call the run() method on this class. In which case, overriding it with one which throws an exception should provide a bit of safety. You're all ready calling it via super() below so that should be unaffected.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic build components should be in lfric_build at the top level, not infrastructure/build.

Comment on lines +54 to +65
def execute(self, parameters: List[Union[Path, str]]) -> None:
'''
This wrapper adds the required PYTHONPATH, and passes all
parameters through to the tool's run function.

:param additional_parameter: A list of parameters for rose picker.
'''
env = os.environ.copy()
env["PYTHONPATH"] = (f"{env.get('PYTHONPATH', '')}:"
f"{self._pythonpath}")

self.run(additional_parameters=parameters, env=env)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Providing an alternative entry point with the correct arguments is good. Please override run() with a version which throws an exception to prevent accidental calling.

This will require calls to it within this class to make use of super().



# =============================================================================
def get_rose_picker(tag: str = "v2.0.0") -> RosePicker:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for. We expect external tools like Rose Picker to be on the path. If it is, then it's there and can be called. If it isn't, that's an error and the build should stop. I don't understand the need for all this.


return True

def execute(self, parameters: List[Union[Path, str]]) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should probably return the Path to the files which are generated. Thereby removing the requirement for calling functions to guess.


:returns List[str]: list of all supported compiler profiles.
'''
return ["full-debug", "fast-debug", "production", "unit-tests"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a general problem with there being nothing magical or required about "full debug" or any of the other "profiles." However, specifically there are also integration tests which don't seem to have been covered.

Comment on lines +97 to +107
def setup_cray(self, build_config: BuildConfig) -> None:
'''
This method sets up the Cray compiler and linker flags.
For now call an external function, since it is expected that
this configuration can be very lengthy (once we support
compiler modes).

:param build_config: the Fab build configuration instance
:type build_config: :py:class:`fab.BuildConfig`
'''
setup_cray(build_config, self.args)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a function called setup_cray which calls a function called setup_cray can only ever cause confusion. That goes for all the others. Why does this facade exist?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of the user experience we want to have is that building is always achieved through the same procedure. Specifically, changing into a project directory and issuing a command. The same command. So please rename all build scripts to build. Note that we do not add the .py extension to executables.


logger = logging.getLogger('fab')
logger.setLevel(logging.DEBUG)
fab_skeleton = FabSkeleton(name="skeleton")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that the build executable implements a class named after the project being built yet that class is passed the project name on initialisation. Why not pass that name from the constructor?

class ProjectBuild(LFRicBase):
    def __init__(self):
        super().__init__(name="project")
  
if __name__ == '__main__':
    builder = ProjectBuild()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The CLA has been signed as part of this PR - added by GA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Fab build script for Skeleton apps

2 participants